import threading
import asyncio
from QQapi import MyClient
from SparkApi import app
from QQapi import sixinxin


def run_app1():
    # 创建一个新的事件循环并设置为当前线程的默认事件循环
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)

    # 运行 MyClient.app1()
    MyClient.app1()


def run_app2():
    # 创建一个新的事件循环并设置为当前线程的默认事件循环
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)

    # 运行 sixinxin.app2()
    sixinxin.app2()


if __name__ == '__main__':
    # 创建两个线程，分别执行 app1 和 app2
    thread1 = threading.Thread(target=run_app1)
    thread2 = threading.Thread(target=run_app2)

    # 启动线程
    thread1.start()
    thread2.start()

    # 等待线程结束
    thread1.join()
    thread2.join()
